import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_simple_code/pages/getxVc/logic.dart';

import 'logic.dart';

class GetxmvcPage extends StatelessWidget {
  final logicxm = Get.find<GetxmvcLogic>();
  final logicx = Get.find<GetxVcLogic>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('多依赖'),
        ),
        body: Center(
          child: Container(
            margin: EdgeInsets.only(top: 30),
            child: Column(
              children: [
                GetBuilder<GetxmvcLogic>(
                  builder: (getxmvc) {
                    return Text('vc1数值=${logicxm.state.xcount}',style: TextStyle(fontSize: 30,color: Colors.red),);
                  },
                ),
                GetBuilder<GetxVcLogic>(
                  builder: (getxvc) {
                    return Text('vc2数值=${logicx.state.count}',style: TextStyle(fontSize: 30,color: Colors.purple),);;
                  },
                ),
                ElevatedButton(
                    onPressed: () {
                      logicxm.increase();
                      logicx.increase();
                    },
                    child: Text("改变数据")),
              ],
            ),
          ),
        ),
    );
  }
}
